﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;

namespace TP2
{
    public partial class EditPhysicalClientForm : Form
    {
        int id;
        PhysicalClient FrClient;
        string fio;
        DateTime data;
        string pasport;
        string income;
        OracleConnection con;
        public EditPhysicalClientForm(int idClient, string fio, DateTime date,string pasport,int incom,PhysicalClient fr)
        {
            FrClient = fr;
            id = idClient;
            this.fio = fio;
            this.data = date;
            this.pasport = pasport;
            this.income = incom.ToString();
            InitializeComponent();

        }

        private void buttonOk_Click(object sender, EventArgs e)
        {
            try
            {
                fio = textBoxFio.Text;
                data = dateTimePicker1.Value;
                pasport = maskedTextBox1.Text;
                income = textBoxIncom.Text;
                DBWorkClass dbWork = new DBWorkClass();
                dbWork.EditPhysicalClient(fio, data, pasport, income, id);
                FrClient.refreshTable();
                this.Close();
            }
            catch (FormatException) { MessageBox.Show("ошибка во входных данных"); }
        }

        private void EditPhysicalClientForm_Load(object sender, EventArgs e)
        {
            textBoxFio.Text = fio;
            textBoxIncom.Text = income;
            maskedTextBox1.Text = pasport;
            dateTimePicker1.Value = data;
        }
    }
}
